﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using TripLOA.WebService.Wrappers;

namespace TripLOA.WebService.Serializable
{
    [DataContract]
    public class WSUser : WSObject
    {        
        #region Costructors

        /// <summary>
        /// Default costructor. Set Status to False
        /// </summary>
        public WSUser()
            : this("fail")
        {
            this.Payload = new List<UserInfo>();
        }

        /// <summary>
        /// Costructor. Set status to given value
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        public WSUser(string status)
        {
            this.Status = status;
            this.Payload = new List<UserInfo>();
        }

        /// <summary>
        /// Constructor. Adds to the payload a UserInfo object
        /// </summary>
        /// <param name="status"></param>
        /// <param name="user"></param>
        public WSUser(string status, UserInfo user)
            : this(status)
        {
            this.Payload.Add(user);
        }

        #endregion

        #region Properties

        /// <summary>
        /// List of UserInfo. If client request a single result the response value will be the first item of the list
        /// </summary>
        [DataMember]
        public List<UserInfo> Payload { get; set; }

        /// <summary>
        /// The authentication token generated after a successfull login
        /// </summary>
        [DataMember]
        public string AuthToken { get; set; }

        /// <summary>
        /// The vehicle list version. It is represented with the MD5 hash of concatenation of all Vehicles IDs.
        /// </summary>
        /// <example>If the list contains IDs: ( 120, 220, 300 ) version string will be the result of md5("120,220,300") </example>
        [DataMember]
        public string VehicleListHash { get; set; }

        /// <summary>
        /// The buddy list version. It is represented with the MD5 hash of concatenation of all friends IDs.
        /// </summary>
        /// <example>If the list contains IDs: ( 120, 220, 300 ) version string will be the result of md5("120,220,300") </example>
        [DataMember]
        public string BuddyListHash { get; set; }

        /// <summary>
        /// The banned list version. It is represented with the MD5 hash of concatenation of all friends IDs.
        /// </summary>
        /// <example>If the list contains IDs: ( 120, 220, 300 ) version string will be the result of md5("120,220,300") </example>
        [DataMember]
        public string BannedListHash { get; set; }

        /// <summary>
        /// The notification list version. It is represented with the MD5 hash of concatenation of all friends IDs.
        /// </summary>
        /// <example>If the list contains IDs: ( 120, 220, 300 ) version string will be the result of md5("120,220,300") </example>
        [DataMember]
        public string NotificationListHash { get; set; }

        #endregion
    }

    [DataContract]
    public class WSUserVehicle : WSObject
    {
        #region Costructors

        /// <summary>
        /// Default costructor. Set Status to False
        /// </summary>
        public WSUserVehicle()
            : this("fail")
        {
            this.Payload = new List<VehicleInfo>();
        }

        /// <summary>
        /// Costructor. Set status to given value
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        public WSUserVehicle(string status)
        {
            this.Status = status;
            this.Payload = new List<VehicleInfo>();
        }

        #endregion

        #region Properties

        /// <summary>
        /// List of VehicleInfo. If client request a single result the response value will be the first item of the list
        /// </summary>
        [DataMember]
        public List<VehicleInfo> Payload { get; set; }

        /// <summary>
        /// The list version. It is represented with the MD5 hash of concatenation of all Vehicles IDs.
        /// </summary>
        /// <example>If the list contains IDs: ( 120, 220, 300 ) version string will be the result of md5("120,220,300") </example>
        [DataMember]
        public string Hash { get; set; }

        #endregion
    }

    [DataContract]
    public class WSNotification : WSObject
    {
        #region Constructors
        public WSNotification() 
            :this("fail")
        {
            this.Payload = new List<Notification>();
        }
        public WSNotification(string status)
        {
            this.Status = status;
            this.Payload = new List<Notification>();
        }

        #endregion

        #region Properties
        [DataMember]
        public List<Notification> Payload { get; set; }
        #endregion
    }
}
